Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max_vcpus_topology: ensure that the VM gets correct topology with maximum vcpus #5913

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

rh-jugraham
Copy link
Contributor

@rh-jugraham rh-jugraham commented Sep 23, 2024

Case ID: VIRT-301882

Automates the case that verifies the vm can start with vcpus which is equal to host online cpu number and vm topology is consistent to those configured.

Depends on:

Scenarios + sub-scenarios considered:

  • Only 1 socket
    • No clusters defined, so default is 1
    • clusters = 2n, like 2, 4, 6
  • Only 1 core per socket
  • More than one core per socket
    • More than one socket, clusters defaults to 1
    • clusters = 2n, like 2, 4, 6 ...

Evidence of tests passing:

[root@ampere-mtsnow-altra-11 /]# avocado run --vt-type libvirt vcpu.max_topology
No python imaging library installed. Screendump and Windows guest BSOD detection are disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
No python imaging library installed. PPM image conversion to JPEG disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
JOB ID     : cc65780e04ce032016cb41fc6f302d6fa6446f56
JOB LOG    : /var/log/avocado/job-results/job-2024-10-01T19.00-cc65780/job.log
 (01/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (01/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (76.79 s)
 (02/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (02/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (120.57 s)
 (03/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (03/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (76.69 s)
 (04/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (04/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (121.22 s)
 (05/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (05/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (120.47 s)
 (06/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (06/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (77.83 s)
 (07/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (07/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (121.25 s)
 (08/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (08/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (77.56 s)
 (09/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (09/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (119.84 s)
 (10/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (10/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (121.37 s)
 (11/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (11/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (77.81 s)
 (12/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (12/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (115.15 s)
 (13/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (13/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (76.69 s)
 (14/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (14/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (118.59 s)
 (15/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (15/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (119.08 s)
 (16/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (16/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (72.15 s)
 (17/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (17/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (115.34 s)
 (18/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (18/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (72.05 s)
 (19/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (19/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (118.97 s)
 (20/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (20/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (118.96 s)
 (21/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (21/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (72.14 s)
 (22/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (22/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (115.39 s)
 (23/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (23/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (72.65 s)
 (24/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (24/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (119.11 s)
 (25/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (25/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (119.68 s)
 (26/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (26/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (76.22 s)
 (27/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (27/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (114.86 s)
 (28/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (28/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (76.03 s)
 (29/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (29/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (115.21 s)
 (30/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (30/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (119.53 s)
 (31/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (31/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (76.96 s)
 (32/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (32/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (118.39 s)
 (33/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (33/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (72.18 s)
 (34/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (34/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (118.55 s)
 (35/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (35/35) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (115.24 s)
RESULTS    : PASS 35 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/log/avocado/job-results/job-2024-10-01T19.00-cc65780/results.html
JOB TIME   : 3558.88 s

@rh-jugraham rh-jugraham changed the title Max_vcpus_topology Max_vcpus_topology: Ensure that the VM gets correct topology with maximum vcpus Sep 26, 2024
@rh-jugraham rh-jugraham changed the title Max_vcpus_topology: Ensure that the VM gets correct topology with maximum vcpus Max_vcpus_topology: ensure that the VM gets correct topology with maximum vcpus Sep 26, 2024
@rh-jugraham rh-jugraham force-pushed the max_vcpus_topology branch 2 times, most recently from ec54a0e to e5c01c1 Compare September 26, 2024 18:36
@Yingshun Yingshun added the depend on The PR has dependency on other PRs label Sep 27, 2024
@rh-jugraham rh-jugraham force-pushed the max_vcpus_topology branch 4 times, most recently from 53fab07 to 8a20b8e Compare October 1, 2024 23:15
@rh-jugraham rh-jugraham marked this pull request as ready for review October 7, 2024 21:01
libvirt/tests/src/cpu/vcpu_max_topology.py Outdated Show resolved Hide resolved
libvirt/tests/src/cpu/vcpu_max_topology.py Outdated Show resolved Hide resolved
libvirt/tests/src/cpu/vcpu_max_topology.py Outdated Show resolved Hide resolved
libvirt/tests/src/cpu/vcpu_max_topology.py Show resolved Hide resolved
libvirt/tests/src/cpu/vcpu_max_topology.py Outdated Show resolved Hide resolved
elif (str(cores * clusters) != lscpu_output["Core(s) per socket"]):
test.fail(lscpu_check_fail + "core(s) per socket")

session = vm.wait_for_login()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you reuse the vm session created in L157?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it in this order with the session recreated because in the automation case, lscpu was checked before the others and cpuutil.get_cpu_info(session) automatically runs session.close(). However, the order of these checks shouldn't matter so I moved the lscpu check to the end so that 1 session can be used. I still include the session.close() cmd at the end just in case (but this can be removed if we don't want redundancy).


lscpu_check_fail = "The configured topology is not consistent with the lscpu output within the vm for "
if (str(vcpus_num) != lscpu_output["CPU(s)"]):
test.fail(lscpu_check_fail + "CPU(s)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if 'lscpu_output' or the actual CPU(s) and other items below will be logged for further debugging or not?

Copy link
Contributor Author

@rh-jugraham rh-jugraham Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever I run the test, I get the following in the debug log because of running the cpuutil.get_cpu_info(session), so the output of lscpu is shown:

2024-10-08 13:51:17,815 cpu L0941 INFO | output is ['Architecture: aarch64', 'CPU op-mode(s): 32-bit, 64-bit', 'Byte Order: Little Endian', 'CPU(s): 128', 'On-line CPU(s) list: 0-127', 'Vendor ID: ARM', 'BIOS Vendor ID: Red Hat', 'Model name: Neoverse-N1', 'BIOS Model name: RHEL 10.0.0 ARM Virtual Machine CPU @ 2.0GHz', 'BIOS CPU family: 1', 'Model: 1', 'Thread(s) per core: 1', 'Core(s) per socket: 1', 'Socket(s): 128', 'Stepping: r3p1', 'BogoMIPS: 50.00', 'Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp', 'NUMA node(s): 1', 'NUMA node0 CPU(s): 0-127', 'Vulnerability Gather data sampling: Not affected', 'Vulnerability Itlb multihit: Not affected', 'Vulnerability L1tf: Not affected', 'Vulnerability Mds: Not affected', 'Vulnerability Meltdown: Not affected', 'Vulnerability Mmio stale data: Not affected', 'Vulnerability Reg file data sampling: Not affected', 'Vulnerability Retbleed: Not affected', 'Vulnerability Spec rstack overflow: Not affected', 'Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl', 'Vulnerability Spectre v1: Mitigation; __user pointer sanitization', 'Vulnerability Spectre v2: Mitigation; CSV2, BHB', 'Vulnerability Srbds: Not affected', 'Vulnerability Tsx async abort: Not affected']

libvirt/tests/src/cpu/vcpu_max_topology.py Outdated Show resolved Hide resolved
libvirt/tests/src/cpu/vcpu_max_topology.py Outdated Show resolved Hide resolved
@rh-jugraham
Copy link
Contributor Author

rh-jugraham commented Oct 11, 2024

An updated passing test log:

[root@ampere-mtjade-altra-02 ~]# avocado run --vt-type libvirt --vt-machine-type arm64-mmio vcpu.max_topology
No python imaging library installed. Screendump and Windows guest BSOD detection are disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
No python imaging library installed. PPM image conversion to JPEG disabled. In order to enable it, please install python-imaging or the equivalent for your distro.
JOB ID     : 49a6c4c6e391f6b09111bcc4d492dd851329b574
JOB LOG    : /var/lib/avocado/job-results/job-2024-10-11T13.30-49a6c4c/job.log
 (1/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: STARTED
 (1/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.default_clusters: PASS (106.86 s)
 (2/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: STARTED
 (2/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_socket.many_clusters: PASS (155.50 s)
 (3/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: STARTED
 (3/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.one_core_per_socket: PASS (97.02 s)
 (4/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: STARTED
 (4/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.default_clusters: PASS (156.61 s)
 (5/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: STARTED
 (5/5) type_specific.io-github-autotest-libvirt.vcpu.max_topology.many_cores_per_socket.many_clusters: PASS (157.44 s)
RESULTS    : PASS 5 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/lib/avocado/job-results/job-2024-10-11T13.30-49a6c4c/results.html
JOB TIME   : 678.02 s

Copy link
Contributor

@Yingshun Yingshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yingshun
Copy link
Contributor

@nanli1

@@ -0,0 +1,28 @@
- vcpu.max_topology:
type = vcpu_max_topology
memory = 4000000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liang-cong-red-hat hi lcong,do you think this memory num meets customer usage scenarios, do we need to give the Multiples of 1024

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is KiB, we'd better align it to MiB, otherwise libvirt will help to align. Then we are not able to check it's value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to 4194304, a multiple of 1024

Copy link
Contributor

@liang-cong-red-hat liang-cong-red-hat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Yingshun Yingshun merged commit e92e761 into autotest:master Oct 21, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depend on The PR has dependency on other PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants